global root "C:\Users\hanwa\Desktop\replication"

use "$root\data\IMC_HA_Monthly_Panel_clean.dta", replace

***Column 1: Speed of new claims
preserve
drop if startdate==-1
keep if cem_matched==1
stackedev hb_newclaim_speed imc_small imc_nosmall, cohort(startdate) time(region_ym) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table6", excel symbol(***,**,*) se replace
restore

***Column 2: Speed of CoC
preserve
drop if startdate==-1
keep if cem_matched==1
stackedev hb_coc_speed imc_small imc_nosmall, cohort(startdate) time(region_ym) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table6", excel symbol(***,**,*) se append
restore

use "$root\data\IMC_HA_Quarterly_Panel_clean.dta", replace

***Column 3: Debt identified
preserve
drop if startdate==-1
keep if cem_matched==1
stackedev identir imc_small imc_nosmall, cohort(startdate) time(region_yq) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table6", excel symbol(***,**,*) se append
restore

***Column 4: Debt recovered
preserve
drop if startdate==-1
keep if cem_matched==1
stackedev recover imc_small imc_nosmall, cohort(startdate) time(region_yq) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table6", excel symbol(***,**,*) se append
restore

***Column 5: Debt written Off
preserve
drop if startdate==-1
keep if cem_matched==1
stackedev writter imc_small imc_nosmall, cohort(startdate) time(region_yq) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table6", excel symbol(***,**,*) se append
restore

***Column 6: Overall complaints
preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev complain imc_small imc_nosmall, cohort(startdate) time(region_yq) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table6", excel symbol(***,**,*) se append
restore

***Column 7: Upheld complaints
preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev upheld imc_small imc_nosmall, cohort(startdate) time(region_yq) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table6", excel symbol(***,**,*) se append
restore
